import Vue from 'vue'
import App from './App'

Vue.config.productionTip = false

import store from 'store'
Vue.prototype.$store = store;

//权限跳转
Vue.prototype.navigateTo = (options) => {
	if (!store.state.user.loginStatus) {
		uni.showToast({
			title: "请先登录",
			icon: "none"
		})
		return uni.navigateTo({
			url: "/pages/login/login"
		})
	}
	uni.redirectTo(options)
}

Vue.filter('changeStatus', function(value) {
	switch (value) {
		case 0:
			return '全部';
			break;
		case 1:
			return '待付款';
			break;
		case 2:
			return '待发货';
			break;
		case '全部':
			return 0;
			break;
		case '待付款':
			return 1;
			break;
		case '待发货':
			return 2;
			break;
		default:
			return 2;
	}
})

App.mpType = 'app'

const app = new Vue({
	store,
	...App
})
app.$mount()
